import java.util.LinkedList;
import java.util.Queue;

public class HeapOrder {

    public class Node{
        int val;
        Node left;
        Node right;
        public Node(int val){
            this.val = val;
        }
    }
    public Node create(){
        Node A = new Node(5);
        Node B = new Node(2);
        Node C = new Node(3);
        Node D = new Node(4);
        Node E = new Node(5);
        Node F = new Node(6);
        A.left = B;
        A.right = C;
        B.right = D;
        C.left = E;
        E.right = F;
        return A;
    }
    public void puDis(Node node){
        Queue<Node> queue = new LinkedList<>();
        queue.offer(node);
        while (!queue.isEmpty()){
            Node ret = queue.poll();
            System.out.print(ret.val + " ");
            if (ret.left != null){
                queue.offer(ret.left);
            }
            if (ret.right != null){
                queue.offer(ret.right);
            }
            if (queue.isEmpty()){
                break;
            }
        }
    }
}
